package cn.ruituo.adv4;

import java.io.FileInputStream;
import java.io.IOException;

public class ReadFile2 {
    public static void main(String[] args) {
        FileInputStream fin = null;
        try {
            fin = new FileInputStream("E:\\temp\\java72-java\\README.md");
            byte[] b=new byte[20];
            int len=0;//读取的长度
            while ((len=fin.read(b)) > 0) {//二合一
                String string=new String(b,0,len);
                System.out.println(string);
            }


        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fin != null)
                    fin.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
